/**
 * Created by jelly on 2018/3/13.
 */
function getLang() {
    if (localStorage) {
        if (!(localStorage._lang == null || localStorage._lang == undefined || localStorage._lang == "")) {
            return localStorage._lang;
        }
    } else {
        var lang = getCookie("_lang");
        if (!(lang == null || lang == undefined || lang == "")) {
            return lang;
        }
    }

    var language = navigator.browserLanguage ? navigator.browserLanguage : navigator.language;
    if (language.indexOf('en') > -1) {
        return "en";
    } else if (language.indexOf('zh') > -1) {
        return "tw";
    } else if (language.indexOf('ja') > -1) {
        return "ja";
    } else if (language.indexOf('ko') > -1) {
        return "ko";
    } else {
        return "en";
    }
}

var default_lang = "en";
default_lang = getLang();
var withdraw_fish_enable = true;
var withdraw_fee_eth_enbale = true;
var withdraw_eth_enable = false;
var trade_enbale = true;
var usercenter_enable = true;
var invite_enable = true;
var market_enable = true;
var market_record_page = false;
var gitter_enable = true;
var wechat_enable = true;
var fish_enbale = true;//鱼和鱼缸预售切换
var fish_market_enbale = true;
var buy_fishcoin_enable = false;
var one_page_enable = false;
var market_fee_half = true;
var login_sha256_enable = false;
var google_auth_enable = true;
var websocket_enable = false;
var default_time = new Date().getTime();
var default_html = "fishbowl_sell.html?t=" + default_time;
var default_image = "";

var Data = {
    buying: null,
    auction: null,
    _wallet: null,
    wallet: {},
    goog: false,
    gcode: "",
    googkey: "",
    _layerArray: [],
    _balance: 0,
    _top: -1,
    _invitecode: "",
    fishbowl_list: null,
    fish_list: null,
    _fishbowlMaxPrice: 100000000,
    _fishMaxPrice: 100000000,
    config: {"market_fee_percent": 0.005, "market_fee_minimum": 1},
    _agent: navigator.userAgent.toLowerCase(),
    _current_filter: "all",
    _eth_decimal: 7,
    _fishcoin_decimal: 4,
    isAndroid: function () {
        return Data._agent.indexOf("android") != -1;
    },
    pushLayer: function (layer) {
        if (Data._layerArray.length > 0) {
            css_blur($("#" + Data._layerArray[Data._layerArray.length - 1]), 120);
        } else {
            css_blur($("body"), 120);
            $("body").css("overflow-y", "hidden");
        }
        Data._layerArray.push(layer);
        css_blur($("#" + layer), 0);

    },
    removeLayer: function (layer) {
        var index = -1;
        for (var i = 0; i < Data._layerArray.length; i++) {
            if (Data._layerArray[i] == layer) {
                index = i;
                break;
            }
        }
        if (index >= 0) {
            Data._layerArray.splice(index, 1);
        }
        if (Data._layerArray.length > 0) {
            css_blur($("#" + Data._layerArray[Data._layerArray.length - 1]), 0);
            $("#" + Data._layerArray[Data._layerArray.length - 1]).show();
        } else {
            css_blur($("body"), 0);
            $("body").css("overflow-y", "auto");
            $("body").show();
            if (Data._top != -1) {
                $(document).scrollTop(Data._top);
                Data._top = -1;
            }
        }
        css_blur($("#" + layer), 0);
    },
    callback: function (json) {
        if (json.wallet) {
            if (json.wallet.eth != null) {
                json.wallet.eth = Math.add(Number(json.wallet.eth.toFixed(Data._eth_decimal)), 0);
                json.wallet.fishcoin = Math.add(Number(json.wallet.fishcoin.toFixed(Data._fishcoin_decimal)), 0);
            }
            Data.wallet = Data._extend(Data.wallet, json.wallet);
        }
        if (json.fish_list) {
            Data.fish_list = json.fish_list;
        }
        if (json.fishbowl_list) {
            Data.fishbowl_list = json.fishbowl_list;
        }
        if (json.buying) {
            Data.buying = Data._extend(Data.buying, json.buying);
        }
        if (json.auction) {
            Data.auction = Data._extend(Data.auction, json.auction);
        }
        if (json.config) {
            Data.config = Data._extend(Data.config, json.config);
        }
    },
    _extend: function (target, obj) {
        if (target == null) {
            target = {};
        }
        for (var i in obj) {
            target[i] = obj[i];
        }
        return target;
    }
};

(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            //alert(clientWidth);
            if (!clientWidth) return;
            var width = 1080;
            if (isWeixinOrChrome()) {
                width = 360;
            }
            var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
            var isTV = navigator.userAgent.match(/(TV|tv|iPad)/);
            if (isTouchDevice == null || isTV) {
                var _scalex = 0.32;
                var swidth = screen.width * _scalex > 480.0 ? screen.width * _scalex : 480.0;
                if (clientWidth >= swidth) {
                    docEl.style.fontSize = 10 * (swidth / width) + "px";
                } else {
                    docEl.style.fontSize = 10 * (clientWidth / width) + "px";
                }
                //market_record_page = true;
            } else {
                if (clientWidth >= 640) {
                    docEl.style.fontSize = 10 * (640 / width) + "px";
                } else {
                    docEl.style.fontSize = 10 * (clientWidth / width) + "px";
                }
                //market_record_page = false;
            }

            var _loading = new Image();
            _loading.src = "../static/images/loading.gif";
            var agent = navigator.userAgent.toLowerCase();
            if (agent.indexOf("android") != -1 || agent.indexOf("firefox") != -1) {
                var _style = $("<style>.message_box{background-color: rgba(235,237,247,1);}</style>");
                _style.appendTo("html");
            }
            if (fish_enbale) {
                default_html = "fish_sell.html?t=" + default_time;
            }
            if (typeof addToHomescreen == "function") {
                //addToHomescreen();
            }
        };

    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', function () {
        recalc();
        $("body").css("display", "block");
    }, false);
    if (isWeixinOrChrome()) {
        if (document.getElementById("css_intlTelInput") != null) {
            document.getElementById("css_intlTelInput").href = "../static/css/intlTelInput.fishchain.360.css";
        }
        if (document.getElementById("theme") != null) {
            document.getElementById("theme").href = "../static/css/default.360.css";
        }
    }
    // if (!isLogin()) {
    //     goLogin();
    // }
    document.ondragstart = function () {
        return false;
    }
})(document, window);

function isWeixinOrChrome() {
    var agent = navigator.userAgent.toLowerCase();
    var scrWidth = screen.width;
    var scrHeight = screen.height;
    var elemWidth = document.documentElement.clientWidth;
    var elemHeight = document.documentElement.clientHeight;
    var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
    var mobileOS = typeof orientation != "undefined";
    var touchOS = ("ontouchstart" in document.documentElement);
    var iOS = (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1);
    var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS);
    if (agent.indexOf("chrome") != -1) {
        return true;
    }
    if (android && agent.indexOf("micromessenger") != -1) {
        return true;
    }
    return false;
}

function isWeixin() {
    var agent = navigator.userAgent.toLowerCase();
    var scrWidth = screen.width;
    var scrHeight = screen.height;
    var elemWidth = document.documentElement.clientWidth;
    var elemHeight = document.documentElement.clientHeight;
    var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
    var mobileOS = typeof orientation != "undefined";
    var touchOS = ("ontouchstart" in document.documentElement);
    var iOS = (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1);
    var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS);
    if (android && agent.indexOf("micromessenger") != -1) {
        return true;
    }
    return false;
}

function isChrome() {
    var agent = navigator.userAgent.toLowerCase();
    var scrWidth = screen.width;
    var scrHeight = screen.height;
    var elemWidth = document.documentElement.clientWidth;
    var elemHeight = document.documentElement.clientHeight;
    var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
    var mobileOS = typeof orientation != "undefined";
    var touchOS = ("ontouchstart" in document.documentElement);
    var iOS = (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1);
    var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS);
    if (android && agent.indexOf("chrome") != -1) {
        return true;
    }
    return false;
}

function loadProperties(lang) {
    $.i18n.properties({
        name: 'strings',    //属性文件名     命名格式： 文件名_国家代号.properties
        path: '../static/i18n/',   //注意这里路径是你属性文件的所在文件夹
        mode: 'map',
        language: lang,     //这就是国家代号 name+language刚好组成属性文件名：strings+zh -> strings_zh.properties
        cache: false,
        callback: function () {
            $('[data-i18n-placeholder]').each(function () {
                $(this).attr('placeholder', $.i18n.prop($(this).data('i18n-placeholder')));
            });
            $('[data-i18n-text]').each(function () {
                $(this).html($.i18n.prop($(this).data("i18n-text")));
            });
            $('[data-i18n-value]').each(function () {
                $(this).val($.i18n.prop($(this).data('i18n-value')));
            });
        }
    });
}

function saveSession(json) {
    if (localStorage) {
        var exdays = 1;
        localStorage._sid = json.sid;
        localStorage._ver = json.ver;
        localStorage._key = json.key;
        localStorage._uid = json.uid;
        localStorage._expires = new Date().getTime() + (exdays * 24 * 60 * 60 * 1000);
        localStorage.removeItem("fishponds_gene");
    } else {
        setCookie("_sid", json.sid, 0);
        setCookie("_ver", json.ver, 0);
        setCookie("_key", json.key, 0);
        setCookie("_uid", json.uid, 0);
    }
}

function clearSession() {
    if (localStorage) {
        localStorage.removeItem("_sid");
        localStorage.removeItem("_ver");
        localStorage.removeItem("_key");
        localStorage.removeItem("_uid");
        localStorage.removeItem("_expires");
        localStorage.removeItem("fishponds_gene");
    } else {
        setCookie("_sid", "", -1);
        setCookie("_ver", "", -1);
        setCookie("_key", "", -1);
        setCookie("_uid", "", -1);
    }

}

function setCookie(cname, cvalue, exdays) {
    var expires = "";
    if (exdays > 0 || exdays < 0) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        expires = "expires=" + d.toGMTString();
    }
    document.cookie = cname + "=" + cvalue + "; " + expires;
}

function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i].trim();
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

function isLogin() {
    if (location.href.indexOf("agreement.html") < 0
        && location.href.indexOf("auth_google.html") < 0
        && location.href.indexOf("confirmbox.html") < 0
        && location.href.indexOf("depositbox.html") < 0
        && location.href.indexOf("help.html") < 0
        && location.href.indexOf("invitebox.html") < 0
        && location.href.indexOf("lang.html") < 0
        && location.href.indexOf("login.html") < 0
        && location.href.indexOf("messagebox.html") < 0
        && location.href.indexOf("password.html") < 0
        && location.href.indexOf("signup.html") < 0
        && location.href.indexOf("tips.html") < 0
        && location.href.indexOf("testcircle.html") < 0
        && location.href.indexOf("testfishing.html") < 0
        && location.href.indexOf("fishponds.html") < 0
    ) {
        var _sid;
        if (localStorage) {
            if (localStorage._expires < new Date().getTime()) {
                return false;
            }
            _sid = localStorage._sid;
        } else {
            _sid = getCookie("_sid");
        }
        if (_sid == null || _sid == undefined || _sid == "" || _sid == "undefined" || _sid == "null") {
            return false;
        }
    }
    return true;
}

// function goLogin() {
//     if (location.href.indexOf("/html/") > 0) {
//         location.href = "login.html?ref=" + location.href.replace(".html", "-html") + "&t=" + default_time;
//     } else {
//         location.href = "/html/login.html?ref=" + location.href.replace(".html", "-html") + "&t=" + default_time;
//     }
// }
function getCountry() {
    var _dialcode = "";
    if (localStorage) {
        if (localStorage._dialcode) {
            _dialcode = localStorage._dialcode;
        } else {
            var _country = "";
            var language = (navigator.language || navigator.browserLanguage).toLowerCase();
            console.log(language);
            var _languageArray = language.split("-");
            if (_languageArray.length >= 2) {
                _country = _languageArray[1];
            } else {
                _country = _languageArray[0];
            }
            if (_country != "") {
                var _countryData = $.fn.intlTelInput.getCountryData();
                for (var i = 0; i < _countryData.length; i++) {
                    var c = _countryData[i];
                    if (c.iso2 == _country) {
                        return _country;
                    }
                }
            }
            return "us";
            /*
            if (language.indexOf('en') > -1) {
                _dialcode = "us";
            } else if (language.indexOf('zh') > -1) {
                _dialcode = "cn";
            } else if (language.indexOf('jp') > -1) {
                _dialcode = "jp";
            } else if (language.indexOf('kr') > -1) {
                _dialcode = "kr";
            } else if (language.indexOf('ru') > -1) {
                _dialcode = "ru";
            } else {
                _dialcode = "us";
            }
            */
        }
    }
    return _dialcode;
}

function setCountry(dialcode) {
    localStorage._dialcode = dialcode;
}

function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}

function initMenu(id) {
    $("#menu_game").click(function () {
        location.href = "fishponds.html?t=" + default_time;
    });

    if (fish_enbale) {
        $("#menu_fishtank .menu_label_div a").html($.i18n.prop("fish_menu"));
        $("#menu_fishtank .menu_label_div a").attr("data-i18n-text", "fish_menu");
    }
    if (trade_enbale) {
        $("#menu_exchange .menu_label_div a").html($.i18n.prop("exchange"));
        $("#menu_exchange .menu_label_div a").attr("data-i18n-text", "exchange");
    }
    $("#menu_fishtank").click(function () {
        if (fish_enbale) {
            location.href = "fish_sell.html?t=" + default_time;
        } else {
            location.href = "fishbowl_sell.html?t=" + default_time;
        }
    });
    $("#menu_exchange").click(function () {
        if (trade_enbale == false) {
            location.href = "my_currency.html?t=" + default_time;
            //showMessageBox($.i18n.prop("message_lock"));
            return;
        }
        location.href = "exchange.html?t=" + default_time;
    });
    $("#menu_assets").click(function () {
        location.href = "my.html?t=" + default_time;
    });
    $("#menu_market").click(function () {
        if (market_enable == false) {
            showMessageBox($.i18n.prop("message_lock"));
            return;
        }
        location.href = "fishbowl_market.html?t=" + default_time;
    });
    /*
    if (market_enable) {
        $("#menu_exchange img").attr("src", $("#menu_exchange img").attr("src").replace("exchange", "market"));
        $("#menu_exchange .menu_label_div a").html($.i18n.prop("market"));
    }
    */
    var date_market = localStorage.getItem("date_market");
    var date_value = new Date().Format("yyyy-MM-dd");
    if (date_market != date_value) {
        $(".market_red_position").show();
    } else {
        $(".market_red_position").hide();
    }
    localStorage.setItem("date_market", date_value);

    if ($("#button_follow_wechat").length > 0) {
        if (wechat_enable) {
            $("#button_follow_wechat").show();
        } else {
            $("#button_follow_wechat").hide();
        }
        $("#button_follow_wechat").click(function () {
            if (getLang() == "tw" || getLang() == "zh") {
                getContent("wechatbox.html");
            } else {
                window.open("https://t.me/fishchain");
            }
        });
        if (getLang() == "tw" || getLang() == "zh") {
            $("#button_follow_wechat").attr("src", "../img/icon_wechat.png");
        } else {
            $("#button_follow_wechat").attr("src", "../img/icon_tele.png");
        }
    }
    if ($(".invite_red_position").length > 0) {
        $(".invite_red_position").show();
    }
    if ($(".my_button").length > 0) {
        $(".my_button").attr("href", "my.html?t=" + default_time);
        $(".my_button").click(function () {
            //location.href = "my.html?t=" + default_time;
        });
    }


}

function initDialCode(ele) {
    ele.intlTelInput({
        separateDialCode: true,
        preferredCountries: ["us", "cn", "gb", "ca", "jp", "kr", "in", "id", "ru"]
    });
    //$("#phone").intlTelInput("setCountry", "cn");
    var _dialcode = getCountry();
    if (_dialcode != "" && _dialcode != null && _dialcode != undefined) {
        ele.intlTelInput("setCountry", _dialcode);
    }
}

function requestFullScreen() {
    var de = document.documentElement;
    if (de.requestFullscreen) {
        de.requestFullscreen();
    } else if (de.mozRequestFullScreen) {
        de.mozRequestFullScreen();
    } else if (de.webkitRequestFullScreen) {
        de.webkitRequestFullScreen();
    }
}

function countdownHtml(button) {
    var _smsTime = 60;
    var _html = button.html();
    button.attr({"disabled": "disabled"});
    button.html(_smsTime);
    var _hander = setInterval(function () {
        _smsTime--;
        if (_smsTime <= 0) {
            clearInterval(_hander);
            button.html(_html);
            button.removeAttr("disabled");
        }
        else {
            button.html(_smsTime);
        }
    }, 1000);
}

function _checkTime(i) {
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

function _leftTimer(ele, leftTime, isShowDay) {
    var _days = parseInt(leftTime / 60 / 60 / 24, 10); //计算剩余的天数
    var _hours = parseInt(leftTime / 60 / 60, 10); //计算剩余的小时
    var _minutes = parseInt(leftTime / 60 % 60, 10);//计算剩余的分钟
    var _seconds = parseInt(leftTime % 60, 10);//计算剩余的秒数
    _days = _days;
    _hours = _checkTime(_hours);
    _minutes = _checkTime(_minutes);
    _seconds = _checkTime(_seconds);
    if (isShowDay == null || isShowDay == undefined || isShowDay == false) {
        ele.html(_hours + ":" + _minutes + ":" + _seconds);
    } else {
        if (_days > 0) {
            _hours = parseInt(leftTime / 60 / 60 % 24, 10); //计算剩余的小时
            _hours = _checkTime(_hours);
            ele.html(_days + "d " + _hours + ":" + _minutes + ":" + _seconds);
        } else {
            ele.html(_hours + ":" + _minutes + ":" + _seconds);
        }
    }
    /*
    if (_days > 0) {
        ele.html(_hours + ":" + _minutes + ":" + _seconds);
    } else {
        ele.html(_hours + ":" + _minutes + ":" + _seconds);
    }
    */
}

function cleanTimer(ele) {
    if (ele.data("intervalId") != null && ele.data("intervalId") != undefined && ele.data("intervalId") != "") {
        clearInterval(ele.data("intervalId"));
    }
}

function leftTimer(ele, leftTime, callback, isShowDay) {
    if (ele.data("intervalId") != null && ele.data("intervalId") != undefined && ele.data("intervalId") != "") {
        clearInterval(ele.data("intervalId"));
    }
    if (leftTime <= 0) {
        leftTime = 0;
    }
    _leftTimer(ele, leftTime, isShowDay);
    /*
    if (leftTime == 0) {
        if (typeof callback == "function") {
            callback();
        }
        return;
    }
    */
    var _hander = setInterval(function () {
        leftTime--;
        if (leftTime >= 0) {
            _leftTimer(ele, leftTime, isShowDay);
        }
        if (leftTime <= 0) {
            clearInterval(_hander);
            if (typeof callback == "function") {
                callback();
            }
            return;
        }
    }, 1000);
    ele.data("intervalId", _hander);
}

function preloadImg(srcArr) {
    if (srcArr instanceof Array) {
        for (var i = 0; i < srcArr.length; i++) {
            var oImg = new Image();
            oImg.src = srcArr[i];
        }
    }
}

function showInputError(input, info) {
    if ($("#error_info").length <= 0) {
        var _div = $("<div></div>");
        _div.attr("id", "error_info");
        _div.addClass("input_error_font");
        _div.addClass("input_error_panel");
        _div.appendTo("html");
    }
    else {
        $("#error_info").show();
    }
    var _offset = input.offset();
    $("#error_info").html($.i18n.prop(info));
    var _ooffset = $("#error_info").height();
    $("#error_info").css({
        "top": _offset.top + input.height(),
        "left": _offset.left + input.height() / 2,
        "z-index": 1
    });
    $("#error_info").css({
        "top": _offset.top - $("#error_info").height(),
        "left": _offset.left + input.height() / 2,
        "z-index": 1
    });

}

function hideInputError() {
    if ($("#error_info").length > 0) {
        $("#error_info").hide();
    }
}

function createLoading() {
    var _div = $("<div></div>");
    _div.attr("id", "loading_background");
    _div.addClass("loading_background");
    _div.hide();
    _div.appendTo("html");

    var _div1 = $("<div></div>");
    _div1.attr("id", "loading_progressBar");
    _div1.addClass("loading_progressBar");
    _div1.hide();
    _div1.appendTo("html");
}

function showLoading() {
    if ($("#loading_background").length <= 0) {
        createLoading();
    }
    $("#loading_background, #loading_progressBar").show();
}

function hideLoading() {
    if ($("#loading_background, #loading_progressBar").length > 0) {
        $("#loading_background, #loading_progressBar").hide();
    }
}

function getContent(url, callback, cache) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id).length <= 0 || cache == true) {
        if (url == "messagebox.html") {
            Data.pushLayer(_url_id);
            var _div = $("<div></div>");
            _div.attr("id", _url_id);
            _div.addClass("message_box");
            var data = '<section class="confirmbox_position"><div><div id="message_content" class="content_width content_light_font margin-top-bottom center">&nbsp;</div></div><div class="center"><a class="button blue" id="button_message_ok"></a></div></section>';
            _div.html(data);
            _div.hide();
            //div.appendTo("body");
            //$("body").after(_div);
            _div.appendTo("html");
            loadProperties(default_lang);
            showClose(url);
            if (typeof callback == "function") {
                callback();
            }
            $("#" + _url_id).show();
            extendgitter();
        } else if (url == "confirmbox.html") {
            Data.pushLayer(_url_id);
            var _div = $("<div></div>");
            _div.attr("id", _url_id);
            _div.addClass("message_box");
            var data = '<section class="confirmbox_position"><div><div class="content_width content_bold_big_font margin-top-bottom center" id="confirm_content">&nbsp;</div></div><div class="center"><a class="button blue confirm_button_margin" id="button_confirm_cancel"></a><a class="button blue confirm_button_margin" id="button_confirm_ok"></a></div></section>';
            _div.html(data);
            _div.hide();
            //div.appendTo("body");
            //$("body").after(_div);
            _div.appendTo("html");
            loadProperties(default_lang);
            showClose(url);
            if (typeof callback == "function") {
                callback();
            }
            $("#" + _url_id).show();
            extendgitter();
        } else if (url == "infobox.html") {
            Data.pushLayer(_url_id);
            var _div = $("<div></div>");
            _div.attr("id", _url_id);
            _div.addClass("message_box");
            var data = '<div><div id="info_content" class="content_width content_font margin-top">&nbsp;</div></div>';
            _div.html(data);
            _div.hide();
            //div.appendTo("body");
            //$("body").after(_div);
            _div.appendTo("html");
            loadProperties(default_lang);
            showClose(url);
            if (typeof callback == "function") {
                callback();
            }
            $("#" + _url_id).show();
            extendgitter();
        } else {
            showLoading();
            $.get(url + "?t=" + new Date().getTime(), function (data) {
                hideLoading();
                Data.pushLayer(_url_id);
                var _reg_body = /<body[^>]*>([\s\S]*)<\/body>/;
                var _result = _reg_body.exec(data);
                if (_result && _result.length === 2) {
                    data = _result[1];
                }
                var _div = $("<div></div>");
                _div.attr("id", _url_id);
                _div.addClass("message_box");
                _div.html(data);
                _div.hide();
                //div.appendTo("body");
                //$("body").after(_div);
                _div.appendTo("html");
                loadProperties(default_lang);
                showClose(url);
                if (typeof callback == "function") {
                    callback();
                }
                $("#" + _url_id).show();
                extendgitter();
            });
        }
    } else {
        Data.pushLayer(_url_id);
        $("#" + _url_id).remove().appendTo("html");
        showClose(url);
        if (typeof callback == "function") {
            callback();
        }
        $("#" + _url_id).show();
        extendgitter();
    }
}

function closeContent(url) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id).length > 0) {
        $("#" + _url_id).hide();
    }
    closeClose(url);
    Data.removeLayer(_url_id);
    hideInputError();
    var _hander = setInterval(function () {
        clearInterval(_hander);
        console.log(Data._top);
        //$(document).scrollTop(Data._top);
        //Data._top = 0;
    }, 0);
    $("#" + _url_id).trigger("blur")
}

function showClose(url) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id + "_close").length <= 0) {
        var _div = $("<div></div>");
        _div.attr("id", _url_id + "_close");
        _div.addClass("close_button");
        var _a = $("<a></a>");
        //_a.attr("href", "#");
        _a.css({"display": "inline-block"});
        _a.addClass("close_button_position");
        _a.appendTo(_div);
        _a.click(function () {
            closeContent(url);
        });
        var _img = $("<img/>");
        _img.attr("src", "../img/icon_close.png");
        _img.addClass("close_icon_height");
        _img.appendTo(_a);
        $("#" + _url_id).after(_div);
    } else {
        $("#" + _url_id + "_close").remove().appendTo("html");
        $("#" + _url_id + "_close").unbind("click").click(function () {
            closeContent(url);
        });
    }
}

function closeClose(url) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id + "_close").length > 0) {
        $("#" + _url_id + "_close").remove();
    }
}

function getTips(url, callback, cache) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id).length <= 0 || cache == true) {
        if (url == "tips.html") {
            var _div = $("<div></div>");
            _div.attr("id", _url_id);
            _div.addClass("tips_box");
            var data = '<div id="tips" class="tips_header"><div class="content_bold_white_font tips_content" id="tips_content">&nbsp;</div><a class="button gray" data-i18n-text="view" id="button_tips_view">{view}</a></div>';
            _div.html(data);
            _div.hide();
            //div.appendTo("body");
            //$("body").after(_div);
            _div.appendTo("html");
            loadProperties(default_lang);
            showTipsClose(url);
            if (typeof callback == "function") {
                callback();
            }
            $("#" + _url_id).show();
        } else {
            showLoading();
            $.get(url + "?t=" + new Date().getTime(), function (data) {
                hideLoading();
                var _reg_body = /<body[^>]*>([\s\S]*)<\/body>/;
                var _result = _reg_body.exec(data);
                if (_result && _result.length === 2) {
                    data = _result[1];
                }
                var _div = $("<div></div>");
                _div.attr("id", _url_id);
                _div.addClass("tips_box");
                _div.html(data);
                _div.hide();
                //div.appendTo("body");
                //$("body").after(_div);
                _div.appendTo("html");
                loadProperties(default_lang);
                showTipsClose(url);

                if (typeof callback == "function") {
                    callback();
                }
                $("#" + _url_id).show();
            });
        }
    } else {
        $("#" + _url_id).remove().appendTo("html");
        showTipsClose(url);
        if (typeof callback == "function") {
            callback();
        }
        $("#" + _url_id).show();
    }
}

function closeTips(url) {
    var _url_id = url.replace(".", "_");
    if ($("#" + _url_id).length > 0) {
        $("#" + _url_id).hide();
    }
    if ($("#button_tips_close").length > 0) {
        $("#button_tips_close").remove();
    }
    hideInputError();
}

function showTipsClose(url) {
    var _url_id = url.replace(".", "_");
    if ($("#button_tips_close").length <= 0) {
        var _div = $("<div></div>");
        _div.attr("id", "button_tips_close");
        _div.addClass("close_button");
        var _a = $("<a></a>");
        //_a.attr("href", "#");
        _a.css({"display": "inline-block"});
        _a.addClass("close_button_position");
        _a.appendTo(_div);
        _a.click(function () {
            closeTips(url);
        });
        var _img = $("<img/>");
        _img.attr("src", "../img/icon_close.png");
        _img.addClass("close_icon_height");
        _img.appendTo(_a);
        $("#" + _url_id).after(_div);
    } else {
        $("#button_tips_close").remove().appendTo("html");
        $("#button_tips_close").unbind("click").click(function () {
            closeTips(url);
        });
    }
}

function closeTipsClose() {
    if ($("#button_tips_close").length > 0) {
        $("#button_tips_close").hide();
    }
}

function css_blur(ele, num) {
    var agent = navigator.userAgent.toLowerCase();
    if (agent.indexOf("android") != -1 || agent.indexOf("firefox") != -1) {
        return;
    }
    if (num == 0) {
        ele.css("-webkit-filter", "");
        ele.css("-moz-filter", "");
        ele.css("-o-filter", "");
        ele.css("-ms-filter", "");
        ele.css("filter", "");
    } else {
        ele.css("-webkit-filter", "blur(" + num + "px)");
        ele.css("-moz-filter", "blur(" + num + "px)");
        ele.css("-o-filter", "blur(" + num + "px)");
        ele.css("-ms-filter", "blur(" + num + "px)");
        ele.css("filter", "blur(" + num + "px)");
    }
}

function copyToClipBoard(text) {
    if (document.execCommand) {
        var _textarea = $("<input/>");
        _textarea.attr("id", "textarea_copy");
        _textarea.css({"position": "absolute"});
        _textarea.css({"left": "-999rem"});
        _textarea.css({"z-index": "999999"});
        _textarea.attr("readonly", "readonly");
        _textarea.val(text);
        _textarea.appendTo("html");
        var ele = document.getElementById("textarea_copy");
        ele.select();
        ele.setSelectionRange(0, ele.value.length);
        document.execCommand("copy");
        _textarea.remove();
        return true;
    }
    return false;
}

function extendData(data) {
    $('[data-text]').each(function () {
        var _array = $(this).data("text").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                var _curr = false;
                if (_array[0].length > 5 && _array[0].substring(_array[0].length - 5) == "_curr") {
                    _array[0] = _array[0].substring(0, _array[0].length - 5);
                    _curr = true;
                }
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    if (_curr == true) {
                        $(this).html(formatCurrency(_temp[_array[0]]));
                    } else {
                        if (_array[0] == "eth") {
                            $(this).html(_temp[_array[0]].toFixed(Data._eth_decimal));
                        } else {
                            $(this).html(_temp[_array[0]]);
                        }
                    }
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
    $('[data-value]').each(function () {
        var _array = $(this).data("value").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    $(this).val(_temp[_array[0]]);
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
    $("[data-image]").each(function () {
        var _array = $(this).data("image").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    $(this).attr("src", _temp[_array[0]]);
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
}

function extendDataByElement(ele, data) {
    ele.data("obj", data);
    ele.find("[data-text]").each(function () {
        var _array = $(this).data("text").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                var _curr = false;
                if (_array[0].length > 5 && _array[0].substring(_array[0].length - 5) == "_curr") {
                    _array[0] = _array[0].substring(0, _array[0].length - 5);
                    _curr = true;
                }
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    if (_curr == true) {
                        $(this).html(formatCurrency(_temp[_array[0]]));
                    } else {
                        if (_array[0] == "eth") {
                            $(this).html(_temp[_array[0]].toFixed(Data._eth_decimal));
                        } else {
                            $(this).html(_temp[_array[0]]);
                        }
                    }
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
    ele.find("[data-value]").each(function () {
        var _array = $(this).data("value").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    $(this).val(_temp[_array[0]]);
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
    ele.find("[data-image]").each(function () {
        var _array = $(this).data("image").split(".");
        var _temp = data;
        while (_array.length > 0) {
            if (_array.length == 1) {
                if (_temp[_array[0]] != null && _temp[_array[0]] != undefined) {
                    $(this).attr("src", _temp[_array[0]]);
                }
                break;
            } else {
                _temp = _temp[_array[0]];
                if (_temp == null || _temp == undefined) {
                    break;
                }
                _array.shift();
            }
        }
    });
}

function extendList(list, cell, array, callback) {
    cell.hide();
    for (var i = 0; i < array.length; i++) {
        var obj = array[i];
        var ele = cell;
        if (i == 0) {
            ele.show();
        } else {
            ele = cell.clone();
            ele.appendTo(list);
        }
        if (!(callback == null || callback == undefined)) {
            var idx = i;
            callback(obj, ele, idx);
        }
        extendDataByElement(ele, obj);
    }
}

function appendList(list, cell, array, callback) {
    for (var i = 0; i < array.length; i++) {
        var obj = array[i];
        var ele = cell.clone();
        ele.appendTo(list);
        if (!(callback == null || callback == undefined)) {
            var idx = i;
            callback(obj, ele, idx);
        }
        extendDataByElement(ele, obj);
    }
    if (!(callback == null || callback == undefined)) {
        var _array = list.find("[data-cell]");
        for (var i = 0; i < _array.length; i++) {
            var idx = i;
            callback($(_array[i]).data("obj"), $(_array[i]), idx);
        }
    }

}

function replaceList(list, cell, array, callback) {
    for (var i = 0; i < array.length && i < cell.length; i++) {
        var obj = array[i];
        var ele = $(cell[i]);
        if (!(callback == null || callback == undefined)) {
            var idx = i;
            callback(obj, ele, idx);
        }
        extendDataByElement(ele, obj);
    }
}

function cleanList(list, cell, array, callback) {
    var _array = cell;
    for (var i = 0; i < _array.length; i++) {
        if (i > 0) {
            _array[i].remove();
        } else {
            $(_array[i]).hide();
        }
    }
}

function extendOption(ele, option) {
    ele.find("[data-item]").each(function () {
        var _text = $(this).data("item");
        if (_text == option) {
            $(this).show();
        } else {
            $(this).hide();
        }
    });
}

function extendTab(ele, group, selected_callback, unselected_callback) {
    ele.find("[data-tab-group=" + group + "]").each(function () {
        var _name = $(this).data("tab");
        $(this).click(function () {
            ele.find("[data-tab-content-group=" + group + "]").hide();
            ele.find("[data-tab-content-group=" + group + "][data-tab-content=" + _name + "]").show();

            ele.find("[data-tab-group=" + group + "]").each(function () {
                var _n = $(this).data("tab");
                if (!(unselected_callback == null || unselected_callback == undefined)) {
                    unselected_callback($(this), _n);
                }
            });
            if (!(selected_callback == null || selected_callback == undefined)) {
                selected_callback(ele.find("[data-tab-group=" + group + "][data-tab=" + _name + "]"), _name);
            }
        });
        if ($(this).data("tab-selected") == true) {
            ele.find("[data-tab-content-group=" + group + "]").hide();
            ele.find("[data-tab-content-group=" + group + "][data-tab-content=" + _name + "]").show();
        }
    });
}

function extendAnimateNumber(ele, num, plus) {
    ele.prop("number", num);
    ele.animateNumber({number: num + plus});
}

function loadgitter() {
    if (!gitter_enable) {
        return;
    }
    if ($(".js-gitter-toggle-chat-button").length > 0) {
        return;
    }
    var _img = $("<img/>");
    _img.attr("src", "../static/images/icon_chat.png");
    _img.attr("class", "width_height_100");
    var _a = $("<a></a>");
    _a.attr("class", "drag_element js-gitter-toggle-chat-button chat_icon");
    _a.attr("data-gitter-toggle-chat-state", "true");
    _img.appendTo(_a);
    _a.appendTo("html");
    ((window.gitter = {}).chat = {}).options = {
        room: 'fishchain-io/fishchain',
        activationElement: false
    };
    // $(function(){
    //     extendDrag($(".chat_icon"));
    // });
    // $.getScript("https://sidecar.gitter.im/dist/sidecar.v1.js", function() {
    //     document.querySelector('.gitter-chat-embed').addEventListener('gitter-chat-toggle', function(e) {
    //         if (e.detail.state == false) {
    //             $(".js-gitter-toggle-chat-button").show();
    //         } else {
    //             $(".js-gitter-toggle-chat-button").hide();
    //             $(".gitter-chat-embed").remove().appendTo("html");
    //         }
    //     });
    // });
}

function extendgitter() {
    //var _chat = $(".js-gitter-toggle-chat-button");
    //_chat.remove().appendTo("html");
}

function extendDrag(ele) {
    var _coordinate = function (event) {
        switch (event.type) {
            case "touchstart":
            case "touchmove":
            case "touchend":
            case "touchcancel":
                return event.originalEvent.touches[0];
            default:
                return event;
        }
    };
    ele.on("mousedown touchstart", function (e) {
        var _ele = $(this);
        //_ele.css("position", "absolute");
        var positionDiv = _ele.offset();
        var distenceX = _coordinate(e).screenX - positionDiv.left;
        var distenceY = _coordinate(e).screenY - positionDiv.top + $(window).scrollTop();
        $(document).on("mousemove touchmove", function (e) {
            var x = _coordinate(e).screenX - distenceX - ($(document).width() - $("html").width()) / 2;
            var y = _coordinate(e).screenY - distenceY;
            if (x < 0) {
                x = 0;
            } else if (x > $(document).width() - _ele.outerWidth(true)) {
                x = $(document).width() - _ele.outerWidth(true);
            }
            if (y < 0) {
                y = 0;
            } else if (y > $(document).height() - _ele.outerHeight(true)) {
                y = $(document).height() - _ele.outerHeight(true);
            }
            _ele.css({
                "left": x + "px",
                "top": y + "px"
            });
        });
        $(document).on("touchend mouseup", function () {
            //_ele.css("position", "fixed");
            $(document).off("mousemove touchmove");
        });
    });
}

function getDialCode(ele) {
    var dialCode = "";
    if (typeof ele.intlTelInput == "function") {
        var countryData = ele.intlTelInput("getSelectedCountryData");
        dialCode = countryData.dialCode;
    } else {
        var dialCode = $(".selected-dial-code").html();
        if (dialCode.substr(0, 1) == '+') {
            dialCode = dialCode.substr(1);
        }
    }
    return dialCode;
}

function connect_websocket() {
    var _wallet = function () {
        WebSocketProxy.wallet(this, function (target, json) {
            if (JSON.stringify(json) == "{}") {
                WebSocketUtil.refresh();
                var _t = setInterval(function () {
                    _wallet();
                    clearInterval(_t);
                }, 1000);
            }
        });
    };
    _wallet();

    window.addEventListener("focus", function (event) {
        WebSocketProxy.heart();
    });
}

function initPage(lang, id) {
    loadProperties(lang);
    initMenu(id);
}

function formatCurrency(n) {
    return Number(n).toLocaleString();
    var b = parseInt(n).toString();
    var len = b.length;
    if (len <= 3) {
        return b;
    }
    var r = len % 3;
    return r > 0 ? b.slice(0, r) + "," + b.slice(r, len).match(/\d{3}/g).join(",") : b.slice(r, len).match(/\d{3}/g).join(",");
}

var formats = {
    '%': function (val) {
        return '%';
    },
    'b': function (val) {
        return parseInt(val, 10).toString(2);
    },
    'c': function (val) {
        return String.fromCharCode(parseInt(val, 10));
    },
    'd': function (val) {
        return parseInt(val, 10) ? parseInt(val, 10) : 0;
    },
    'u': function (val) {
        return Math.abs(val);
    },
    'f': function (val, p) {
        return (p > -1) ? Math.round(parseFloat(val) * Math.pow(10, p)) / Math.pow(10, p) : parseFloat(val);
    },
    'o': function (val) {
        return parseInt(val, 10).toString(8);
    },
    's': function (val) {
        return val;
    },
    'S': function (val, p) {
        var len = p - val.toString().length;
        for (i = 0; i < len; i++) val = '0' + val;
        return val;
    },
    'x': function (val) {
        return ('' + parseInt(val, 10).toString(16)).toLowerCase();
    },
    'X': function (val) {
        return ('' + parseInt(val, 10).toString(16)).toUpperCase();
    }
};
var re = /%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosSxX])/g;
var dispatch = function (data) {
    if (data.length == 1 && typeof data[0] == 'object') {
        data = data[0];
        return function (match, w, p, lbl, fmt, off, str) {
            return formats[fmt](data[lbl]);
        };
    } else {
        var idx = 0;
        return function (match, w, p, lbl, fmt, off, str) {
            return formats[fmt](data[idx++], p);
        };
    }
};
String.prototype.format = function () {
    return this.replace(re, dispatch(arguments));
};
Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

function showConfirmBox(content, okcallback, cancelcallback, ok, cancel) {
    getContent("confirmbox.html", function () {
        $("#confirm_content").html(content);
        //closeClose();
        if (ok == null || ok == undefined) {
            ok = $.i18n.prop("confirm_ok");
        }
        if (cancel == null || cancel == undefined) {
            cancel = $.i18n.prop("confirm_cancel");
        }
        $("#button_confirm_ok").html(ok);
        $("#button_confirm_cancel").html(cancel);
        $("#button_confirm_ok").unbind('click').click(function () {
            if (!(okcallback == null || okcallback == undefined)) {
                okcallback();
            }
            closeContent("confirmbox.html");
        });
        $("#button_confirm_cancel").unbind('click').click(function () {
            if (!(cancelcallback == null || cancelcallback == undefined)) {
                cancelcallback();
            }
            closeContent("confirmbox.html");
        });
    });
}

function showMessageBox(content, okcallback, ok) {
    getContent("messagebox.html", function () {
        $("#message_content").html(content);
        //closeClose();
        if (ok == null || ok == undefined) {
            ok = $.i18n.prop("confirm_ok");
        }
        $("#button_message_ok").html(ok);
        $("#button_message_ok").unbind('click').click(function () {
            if (!(okcallback == null || okcallback == undefined)) {
                okcallback();
            } else {
                closeMessageBox();
            }
        });
    });
}

function closeMessageBox() {
    closeContent("messagebox.html");
}

function showInfoBox(content, okcallback, ok) {
    getContent("infobox.html", function () {
        $("#info_content").html(content);
    });
}

function closeInfoBox() {
    closeContent("infobox.html");
}

function showTips(content, isError, okcallback, ok) {
    getTips("tips.html", function () {
        if (isError == null || isError == undefined) {
            isError = true;
        }
        if (isError) {
            $("#tips").css("background-color", "rgba(204,0,0,0.97)");
        } else {
            $("#tips").css("background-color", "rgba(0,153,0,0.97)");
        }
        $("#tips_content").html(content);
        closeTipsClose();
        $("#tips_html").css("bottom", "auto");
        if (ok == null || ok == undefined) {
            ok = $.i18n.prop("view");
        }
        if (okcallback == null || okcallback == undefined) {
            $("#button_tips_view").hide();
        }
        $("#button_tips_view").html(ok);
        $("#button_tips_view").unbind('click').click(function () {
            if (!(okcallback == null || okcallback == undefined)) {
                okcallback();
            }
            closeTips("tips.html");
        });
        var _hander = setInterval(function () {
            //$("#tips_html").animate({bottom:"10rem"});
            closeTips("tips.html");
            clearInterval(_hander);
        }, 2000);
    });
}

function showMenu(array, callback) {
    var menu = $('<section id="my_menu"> <div class="absolute my_menu_mask my_menu_mask_panel"></div> <div class="fixed my_menu my_menu_panel" data-list="menu"> <div data-cell="menu"> <div class="menu_item click relative"> <div class="kohinoor_48_semibold center" data-text="name"> </div> <div class="absolute menu_item_selected" style="display: none;"> <img src="../img/icon_select.png" class="market_select_height"/> </div> </div> <div class="line"></div> </div> </div> </section>');
    menu.appendTo($("body"));
    cleanList($("[data-list=menu]"), $("[data-cell=menu]"));
    extendList($("[data-list=menu]"), $("[data-cell=menu]"), array, callback);
    $(".my_menu_mask").unbind("click").click(function () {
        $("#my_menu").remove();
    });
    $("#my_menu").show();
}

function Router() {
    this.curUrl = '';
    this.routes = {};
    this.refresh = function () {
        this.curUrl = location.hash.slice(1) || '/';
        //this.routes[this.curUrl]();
        console.log(this.curUrl);
        loadPage(this.curUrl);
    };
    this.init = function () {
        window.addEventListener('hashchange', this.refresh.bind(this));
        window.addEventListener('load', this.refresh.bind(this));
        //window.addEventListener('popstate', this.onpopstate.bind(this));
    };
    this.onpopstate = function (e) {
        alert("location: " + document.location + ", state: " + JSON.stringify(event.state));
    },
        this.route = function (path, callback) {
            this.routes[path] = callback || function () {
            }
        }
};
var r = new Router();

//r.init();
function loadPage(url) {
    if (url == "/") {
        return;
    }
    showLoading();
    $.get(url + "?t=" + new Date().getTime(), function (data) {
        hideLoading();
        var end = setTimeout(function () {
        }, 1);
        console.log(end);
        var start = (end - 100) > 0 ? end - 100 : 0;
        for (var i = start; i <= end; i++) {
            clearTimeout(i);
        }
        var _data = "";
        var _reg_body = /<body[^>]*>([\s\S]*)<\/body>/;
        var _result = _reg_body.exec(data);
        if (_result && _result.length === 2) {
            _data = _result[1];
        }
        $("body").html(_data);

        loadProperties(default_lang);
    });
}


function playSound(sound) {
    //loadAudioFile(sound);
    return;
    var borswer = window.navigator.userAgent.toLowerCase();
    if (borswer.indexOf("ie") >= 0) {
        //IE内核浏览器
        var strEmbed = '<embed name="embedPlay" src="' + sound + '" autostart="true" hidden="true" loop="false"></embed>';
        if ($("body").find("embed").length <= 0) {
            $("body").append(strEmbed);
        }
        var embed = document.embedPlay;
        //浏览器不支持 audion，则使用 embed 播放
        embed.volume = 100;
        //embed.play();这个不需要
    } else {
        //非IE内核浏览器
        var strAudio = "<audio id='audioPlay' src='" + sound + "' hidden='true'>";
        if ($("body").find("audio").length <= 0) {
            $("body").append(strAudio);
        }
        var audio = document.getElementById("audioPlay");
        //浏览器支持 audion

        var link = document.getElementById('audioPlay'), event = document.createEvent('HTMLEvents');

        event.initEvent('click', true, true);
        link.dispatchEvent(event);

        audio.play();
    }
}

function stopSound() {
    var audio = document.getElementById("audioPlay");
    audio.stop();
}

// window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.msAudioContext;
// var context = new window.AudioContext();
// var source = null;
// var audioBuffer = null;
//
// function stopSound() {
//     if (source) {
//         source.noteOff(0); //立即停止
//     }
// }
//
// function _playSound() {
//     source = context.createBufferSource();
//     source.buffer = audioBuffer;
//     source.loop = false;
//     source.connect(context.destination);
//     source.start(0); //立即播放
// }
//
// function initSound(arrayBuffer) {
//     context.decodeAudioData(arrayBuffer, function (buffer) { //解码成功时的回调函数
//         audioBuffer = buffer;
//         _playSound();
//     }, function (e) { //解码出错时的回调函数
//         console.log('Error decoding file', e);
//     });
// }

function loadAudioFile(url) {
    var xhr = new XMLHttpRequest(); //通过XHR下载音频文件
    xhr.open('GET', url, true);
    xhr.responseType = 'arraybuffer';
    xhr.onload = function (e) { //下载完成
        initSound(this.response);
    };
    xhr.send();
}

///<summary>精确计算乘法。语法：Math.mul(v1, v2)</summary>
///<param name="v1" type="number">操作数。</param>
///<param name="v2" type="number">操作数。</param>
///<returns type="number">计算结果。</returns>
Math.mul = function (v1, v2) {
    var m = 0;
    var s1 = v1.toString();
    var s2 = v2.toString();
    try {
        m += s1.split(".")[1].length;
    }
    catch (e) {
    }
    try {
        m += s2.split(".")[1].length;
    }
    catch (e) {
    }

    return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
}
///<summary>精确计算加法。语法：Math.add(v1, v2)</summary>
///<param name="v1" type="number">操作数。</param>
///<param name="v2" type="number">操作数。</param>
///<returns type="number">计算结果。</returns>
Math.add = function (v1, v2) {
    var r1, r2, m;
    try {
        r1 = v1.toString().split(".")[1].length;
    }
    catch (e) {
        r1 = 0;
    }
    try {
        r2 = v2.toString().split(".")[1].length;
    }
    catch (e) {
        r2 = 0;
    }
    m = Math.pow(10, Math.max(r1, r2));

    return (v1 * m + v2 * m) / m;
}
///<summary>精确计算减法。语法：Math.sub(v1, v2)</summary>
///<param name="v1" type="number">操作数。</param>
///<param name="v2" type="number">操作数。</param>
///<returns type="number">计算结果。</returns>
Math.sub = function (v1, v2) {
    return Math.add(v1, -v2);
}
///<summary>精确计算除法。语法：Math.div(v1, v2)</summary>
///<param name="v1" type="number">操作数。</param>
///<param name="v2" type="number">操作数。</param>
///<returns type="number">计算结果。</returns>
Math.div = function (v1, v2) {
    var t1 = 0;
    var t2 = 0;
    var r1, r2;
    try {
        t1 = v1.toString().split(".")[1].length;
    }
    catch (e) {
    }
    try {
        t2 = v2.toString().split(".")[1].length;
    }
    catch (e) {
    }

    with (Math) {
        r1 = Number(v1.toString().replace(".", ""));
        r2 = Number(v2.toString().replace(".", ""));
        return (r1 / r2) * pow(10, t2 - t1);
    }
}

var SlidePercent = function (ele, opt) {
    this.element = ele,
        this.defaults = {
            onSlider: function (value) {
            }
        },
        this.options = $.extend({}, this.defaults, opt);
    this.init();
};
SlidePercent.prototype = {
    init: function () {
        this.element.empty();
        this.element.css("position", "relative");
        this.track = $("<div class='slider_track'></div>");
        this.track.appendTo(this.element);
        this.track_selected = $("<div class='slider_track_selected'></div>");
        this.track_selected.appendTo(this.track);
        this.thumb = $("<div class='slider_thumb'></div>");
        this.thumb.appendTo(this.element);
        this.statu = false;
        this.ox = 0;
        this.lx = 0;
        this.left = 0;
        this.bgleft = 0;
        this.maxlength = this.track[0].offsetWidth - this.thumb[0].offsetWidth;
        this.value = 0;

        var self = this;
        this.thumb.bind("mousedown touchstart", function (e) {
            e.preventDefault();
            if (!e.touches) {    //兼容移动端
                var x = e.clientX;
            } else {     //兼容PC端
                var x = e.touches[0].pageX;
            }
            console.log(e);
            self.maxlength = self.track[0].offsetWidth - self.thumb[0].offsetWidth;
            console.log(self.maxlength);
            self.lx = self.thumb.offset().left;
            self.ox = x - self.left;
            self.statu = true;
        });
        $(document).bind("mouseup touchend", function () {
            self.statu = false;
        });
        this.element.bind("mousemove touchmove", function (e) {
            if (self.statu) {
                e.preventDefault();
                if (!e.touches) {    //兼容移动端
                    var x = e.clientX;
                } else {     //兼容PC端
                    var x = e.touches[0].pageX;
                }
                self.left = x - self.ox;
                if (self.left < 0) {
                    self.left = 0;
                }
                if (self.left > self.maxlength) {
                    self.left = self.maxlength;
                }
                self.thumb.css('left', self.left);
                self.track_selected.width(self.left + self.maxlength * 0.05);
                self.options.onSlider(self.left / self.maxlength);
                self.value = self.left / self.maxlength;
            }
        });
        this.track.click(function (e) {
            self.maxlength = self.track[0].offsetWidth - self.thumb[0].offsetWidth;
            if (!self.statu) {
                self.bgleft = self.track.offset().left;
                self.left = e.pageX - self.bgleft - self.thumb[0].offsetWidth / 2;
                if (self.left < 0) {
                    self.left = 0;
                }
                if (self.left > self.maxlength) {
                    self.left = self.maxlength;
                }
                //$btn.css('left', left*100/maxlength + "%");
                self.thumb.css('left', self.left);
                self.track_selected.stop().animate({width: self.left + self.maxlength * 0.05}, 200);
                self.options.onSlider(self.left / self.maxlength);
                self.value = self.left / self.maxlength;
            }
        });
    },
    setValue: function (value) {
        this.maxlength = this.track[0].offsetWidth - this.thumb[0].offsetWidth;
        if (value > 1) {
            value = 1;
        }
        this.value = value;
        this.left = this.value * this.maxlength;
        this.thumb.css('left', this.value * this.maxlength);
        this.track_selected.width(this.value * this.maxlength + this.maxlength * 0.05);
    },
    getValue: function () {
        return this.value;
    }
};

var Wave = function (view, graphics, low, high) {
    this.view = view;
    this.graphics = graphics;
    if (low == undefined || low == null) {
        this.low = 115;
    } else {
        this.low = low;
    }
    if (low == undefined || low == null) {
        this.high = 140;
    } else {
        this.high = high;
    }
    this.init();
};
Wave.prototype = {
    fill: function () {
        for (var i = 0; i < this.count1; i++) {
            this.points1[i] = this.low + this.max11 * Math.sin(this.a11 * Math.PI) + this.max21 * Math.sin(this.a21 * Math.PI) + this.max31 * Math.sin(this.a31 * Math.PI);
            this.a11 = this.a11 + this.speed11;
            this.a21 = this.a21 + this.speed21;
            this.a31 = this.a31 + this.speed31;
        }
        for (var i = 0; i < this.count2; i++) {
            this.points2[i] = this.high + this.max12 * Math.sin(this.a12 * Math.PI) + this.max22 * Math.sin(this.a22 * Math.PI) + this.max32 * Math.sin(this.a32 * Math.PI);
            this.a12 = this.a12 + this.speed12;
            this.a22 = this.a22 + this.speed22;
            this.a32 = this.a32 + this.speed32;
        }
    },
    drawAWave: function () {
        var i;
        for (i = 0; i < this.count1 - 1; i++) {
            this.points1[i] = this.points1[i + 1];
            this.points2[i] = this.points2[i + 1];
        }
        this.a11 = this.a11 + this.speed11;
        this.a21 = this.a21 + this.speed21;
        this.a31 = this.a31 + this.speed31;
        this.a12 = this.a12 + this.speed12;
        this.a22 = this.a22 + this.speed22;
        this.a32 = this.a32 + this.speed32;
        this.points1[this.count1 - 1] = this.low + this.max11 * Math.sin(this.a11 * Math.PI) + this.max21 * Math.sin(this.a21 * Math.PI) + this.max31 * Math.sin(this.a31 * Math.PI);
        this.points2[this.count2 - 1] = this.high + this.max12 * Math.sin(this.a12 * Math.PI) + this.max22 * Math.sin(this.a22 * Math.PI) + this.max32 * Math.sin(this.a32 * Math.PI);
        this.graphics.clear();

        this.graphics.beginFill(0x0339ea);
        this.graphics.moveTo(0, this.points1[0]);
        for (i = 1; i < this.count1; i++) {
            this.graphics.lineTo(i * this.step1, this.points1[i]);
        }
        this.graphics.lineTo(this.w, this.points2[this.count2 - 1]);
        for (i = this.count2 - 2; i >= 0; i--) {
            this.graphics.lineTo(i * this.step2, this.points2[i]);
        }
        this.graphics.closePath();
        this.graphics.endFill();
    },
    init: function () {
        this.w = this.view.width + 100;
        this.h = 300;
        this.t = 35;
        this.count1 = 80,
            this.count2 = 80,
            this.step1 = Math.ceil(this.w / this.count1),
            this.step2 = Math.ceil(this.w / this.count2),
            this.points1 = new Array(this.count1),
            this.points2 = new Array(this.count2),
            this.a11 = 0,//相位1
            this.a21 = 0,//相位2
            this.a31 = 0,//相位3
            this.a12 = 0,//相位1
            this.a22 = 0,//相位2
            this.a32 = 0,//相位3
            this.speed11 = 0.04,
            this.speed21 = 0.02,
            this.speed31 = 0.015,
            this.speed12 = 0.05,
            this.speed22 = 0.025,
            this.speed32 = 0.01,
            this.max11 = 5;//振幅1
        this.max21 = 3;//振幅2
        this.max31 = 2.5;//振幅3
        this.max12 = 6;//振幅1
        this.max22 = 4;//振幅2
        this.max32 = 1.5;//振幅3
        this.w = this.view.width + 100;
        this.fill();
        var self = this;
        setInterval(function () {
            self.drawAWave();
        }, 2 * this.t);
    }
};


/**
 * Checks if the given string is an address
 *
 * @method isAddress
 * @param {String} address the given HEX adress
 * @return {Boolean}
 */
function isAddress(address) {
    if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
        // check if it has the basic requirements of an address
        return false;
    } else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address) || /^(0x)?[0-9a-fA-F]{40}$/.test(address)) {
        // If it's all small caps or all all caps, return true
        return true;
    } else {
        // Otherwise check each case
        return isChecksumAddress(address);
        //return false;
    }
}

/**
 * Checks if the given string is a checksummed address
 *
 * @method isChecksumAddress
 * @param {String} address the given HEX adress
 * @return {Boolean}
 */
function isChecksumAddress(address) {
    // Check each case
    address = address.replace('0x', '');
    //var addressHash = sha3(address.toLowerCase());
    //var addressHash = sha256(address.toLowerCase());
    var addressHash = sha512(address.toLowerCase());


    for (var i = 0; i < 40; i++) {
        // the nth letter should be uppercase if the nth digit of casemap is 1
        if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
            return false;
        }
    }
    return true;
}

function isNumber(value) {         //验证是否为数字
    var patrn = /^(-)?\d+(\.\d+)?$/;
    if (patrn.exec(value) == null || value == "") {
        return false
    } else {
        return true
    }
}

function isPassword(value) {
    var patrn = /^(?![^a-zA-Z]+$)(?!\D+$)/;
    if (patrn.exec(value) == null || value == "") {
        return false
    } else {
        return true
    }
}

function hexToString(str) {
    var val = "";
    var arr = str.split(",");
    for (var i = 0; i < arr.length; i++) {
        val += arr[i].fromCharCode(i);
    }
    return val;
}

function getGrady(power) {
    if (power <= 99) {
        return 1;
    } else if (power <= 299) {
        return 2;
    } else if (power <= 999) {
        return 3;
    } else {
        return 4;
    }
}

Number.prototype.toCurrencyString = function () {
    return this.toFixed(0).replace(/\d(?=(?:\d{3})+\b)/g, '$&,'); // 这里看你是不是要小数
}

function array_contain(array, obj) {
    for (var i = 0; i < array.length; i++) {
        if (array[i] == obj)//如果要求数据类型也一致，这里可使用恒等号===
            return true;
    }
    return false;
}

var FishGene = {
    fish_data: {
        "body": [{
            "part": "body",
            "shapeId": "1",
            "color": "black",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "black", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "black",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "blue", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "blue",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "blue", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "gold",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "gold", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "green",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "green", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "green",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "pink", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "pink",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "pink", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "purple",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "purple", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "purple",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "red", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "red",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "red", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "1",
            "color": "white",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "1", "color": "white", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "black",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "black", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "black",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "blue", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "blue",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "blue", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "gold",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "green", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "green",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "green", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "pink",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "pink", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "pink",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "purple", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "purple",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "purple", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "red",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "red", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "2",
            "color": "red",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "2", "color": "white", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "black",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "black", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "black",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "blue", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "blue",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "blue", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "green",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "green", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "green",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "pink", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "pink",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "pink", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "purple",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "purple", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "purple",
            "texture": "3",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "red", "texture": "1", "zindex": "2"}, {
            "part": "body",
            "shapeId": "3",
            "color": "red",
            "texture": "2",
            "zindex": "2"
        }, {"part": "body", "shapeId": "3", "color": "red", "texture": "3", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "black",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "black", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "blue",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "blue", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "green",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "green", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "pink",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "pink", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "purple",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "purple", "texture": "2", "zindex": "2"}, {
            "part": "body",
            "shapeId": "4",
            "color": "red",
            "texture": "1",
            "zindex": "2"
        }, {"part": "body", "shapeId": "4", "color": "red", "texture": "2", "zindex": "2"}],
        "eye": [{
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "gold",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "white",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pruple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "4"
        }, {
            "part": "eye",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "4"
        }, {"part": "eye", "shapeId": "3", "bodyshapeId": ["3"], "color": "red", "texture": "0", "zindex": "4"}],
        "eye-socket": [{
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "gold",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "gold",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "white",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "white",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "4.5"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "3"
        }, {
            "part": "eye-socket",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "3"
        }, {"part": "eye-socket", "shapeId": "3", "bodyshapeId": ["3"], "color": "red", "texture": "0", "zindex": "3"}],
        "fin1": [{
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "gold",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "white",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "5"
        }, {
            "part": "fin1",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "5"
        }, {"part": "fin1", "shapeId": "3", "bodyshapeId": ["4"], "color": "black", "texture": "0", "zindex": "5"}],
        "fin2": [{
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "1."
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "1",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "gold",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["2"],
            "color": "white",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "2",
            "bodyshapeId": ["4"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "gold",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["1"],
            "color": "white",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["2"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "black",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "blue",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "green",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "pink",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "purple",
            "texture": "0",
            "zindex": "1"
        }, {
            "part": "fin2",
            "shapeId": "3",
            "bodyshapeId": ["3"],
            "color": "red",
            "texture": "0",
            "zindex": "1"
        }, {"part": "fin2", "shapeId": "3", "bodyshapeId": ["4"], "color": "black", "texture": "0", "zindex": "1"}],
        "special": []
    },
    degree_obj: {
        "size": [{"id": "1", "degree": "1", "power": "4"}, {
            "id": "2",
            "degree": "1",
            "power": "6"
        }, {"id": "3", "degree": "1", "power": "8"}],
        "body_color": [{"id": "1", "degree": "1", "power": "5"}, {"id": "2", "degree": "1", "power": "8"}, {
            "id": "3",
            "degree": "1",
            "power": "11"
        }, {"id": "4", "degree": "2", "power": "17"}, {"id": "5", "degree": "2", "power": "20"}, {
            "id": "6",
            "degree": "3",
            "power": "35"
        }],
        "body_shape": [{"id": "1", "degree": "2", "power": "32"}, {"id": "2", "degree": "1", "power": "10"}, {
            "id": "3",
            "degree": "1",
            "power": "8"
        }, {"id": "4", "degree": "1", "power": "16"}],
        "body_pattern": [{"id": "1", "degree": "1", "power": "6"}, {
            "id": "2",
            "degree": "1",
            "power": "11"
        }, {"id": "3", "degree": "2", "power": "22"}],
        "eye_color": [{"id": "1", "degree": "1", "power": "5"}, {"id": "2", "degree": "1", "power": "7"}, {
            "id": "3",
            "degree": "1",
            "power": "10"
        }, {"id": "4", "degree": "2", "power": "20"}, {"id": "5", "degree": "2", "power": "24"}, {
            "id": "6",
            "degree": "2",
            "power": "28"
        }, {"id": "7", "degree": "2", "power": "30"}],
        "eye_shape": [{"id": "1", "degree": "1", "power": "7"}, {"id": "2", "degree": "1", "power": "12"}, {
            "id": "3",
            "degree": "2",
            "power": "23"
        }],
        "fin1_shape": [{"id": "1", "degree": "1", "power": "4"}, {"id": "2", "degree": "1", "power": "7"}, {
            "id": "3",
            "degree": "2",
            "power": "15"
        }],
        "fin2_shape": [{"id": "1", "degree": "1", "power": "7"}, {"id": "2", "degree": "1", "power": "11"}, {
            "id": "3",
            "degree": "2",
            "power": "22"
        }]
    },
    fish_size_scale: [0, 1, 1, 1],
    suit_data: [{
        "name": "117",
        "size": "0",
        "color": "1",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "1",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "127",
        "size": "0",
        "color": "2",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "2",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "137",
        "size": "0",
        "color": "3",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "3",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "147",
        "size": "0",
        "color": "4",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "4",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "157",
        "size": "0",
        "color": "5",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "5",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "167",
        "size": "0",
        "color": "6",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "6",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "177",
        "size": "0",
        "color": "7",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "7",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "187",
        "size": "0",
        "color": "8",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "8",
        "fin1_shape": "3",
        "fin2_shape": "3",
        "power": "2.0"
    }, {
        "name": "217",
        "size": "0",
        "color": "1",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "1",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "227",
        "size": "0",
        "color": "2",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "2",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "237",
        "size": "0",
        "color": "3",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "3",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "247",
        "size": "0",
        "color": "4",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "4",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "257",
        "size": "0",
        "color": "5",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "5",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "267",
        "size": "0",
        "color": "6",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "6",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "277",
        "size": "0",
        "color": "7",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "7",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "287",
        "size": "0",
        "color": "8",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "8",
        "fin1_shape": "1",
        "fin2_shape": "1",
        "power": "2.0"
    }, {
        "name": "317",
        "size": "0",
        "color": "1",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "1",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "327",
        "size": "0",
        "color": "2",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "2",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "337",
        "size": "0",
        "color": "3",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "3",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "347",
        "size": "0",
        "color": "4",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "4",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "357",
        "size": "0",
        "color": "5",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "5",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "367",
        "size": "0",
        "color": "6",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "6",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "377",
        "size": "0",
        "color": "7",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "7",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "387",
        "size": "0",
        "color": "8",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "8",
        "fin1_shape": "2",
        "fin2_shape": "2",
        "power": "2.0"
    }, {
        "name": "116",
        "size": "0",
        "color": "1",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "126",
        "size": "0",
        "color": "2",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "136",
        "size": "0",
        "color": "3",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "146",
        "size": "0",
        "color": "4",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "156",
        "size": "0",
        "color": "5",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "166",
        "size": "0",
        "color": "6",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "176",
        "size": "0",
        "color": "7",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "186",
        "size": "0",
        "color": "8",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "3",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.5"
    }, {
        "name": "216",
        "size": "0",
        "color": "1",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "226",
        "size": "0",
        "color": "2",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "236",
        "size": "0",
        "color": "3",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "246",
        "size": "0",
        "color": "4",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "256",
        "size": "0",
        "color": "5",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "266",
        "size": "0",
        "color": "6",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "276",
        "size": "0",
        "color": "7",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "286",
        "size": "0",
        "color": "8",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "1",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.5"
    }, {
        "name": "316",
        "size": "0",
        "color": "1",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "326",
        "size": "0",
        "color": "2",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "336",
        "size": "0",
        "color": "3",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "346",
        "size": "0",
        "color": "4",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "356",
        "size": "0",
        "color": "5",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "366",
        "size": "0",
        "color": "6",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "376",
        "size": "0",
        "color": "7",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "386",
        "size": "0",
        "color": "8",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "2",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.5"
    }, {
        "name": "115",
        "size": "0",
        "color": "1",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "125",
        "size": "0",
        "color": "2",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "135",
        "size": "0",
        "color": "3",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "145",
        "size": "0",
        "color": "4",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "155",
        "size": "0",
        "color": "5",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "165",
        "size": "0",
        "color": "6",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "175",
        "size": "0",
        "color": "7",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "185",
        "size": "0",
        "color": "8",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "1.0"
    }, {
        "name": "215",
        "size": "0",
        "color": "1",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "225",
        "size": "0",
        "color": "2",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "235",
        "size": "0",
        "color": "3",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "245",
        "size": "0",
        "color": "4",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "255",
        "size": "0",
        "color": "5",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "265",
        "size": "0",
        "color": "6",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "275",
        "size": "0",
        "color": "7",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "285",
        "size": "0",
        "color": "8",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "1.0"
    }, {
        "name": "315",
        "size": "0",
        "color": "1",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "1",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "325",
        "size": "0",
        "color": "2",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "2",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "335",
        "size": "0",
        "color": "3",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "3",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "345",
        "size": "0",
        "color": "4",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "4",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "355",
        "size": "0",
        "color": "5",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "5",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "365",
        "size": "0",
        "color": "6",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "6",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "375",
        "size": "0",
        "color": "7",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "7",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "385",
        "size": "0",
        "color": "8",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "8",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "1.0"
    }, {
        "name": "114",
        "size": "0",
        "color": "1",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "124",
        "size": "0",
        "color": "2",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "134",
        "size": "0",
        "color": "3",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "144",
        "size": "0",
        "color": "4",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "154",
        "size": "0",
        "color": "5",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "164",
        "size": "0",
        "color": "6",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "174",
        "size": "0",
        "color": "7",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "184",
        "size": "0",
        "color": "8",
        "body_shape": "1",
        "body_texture": "3",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "3",
        "power": "0.5"
    }, {
        "name": "214",
        "size": "0",
        "color": "1",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "224",
        "size": "0",
        "color": "2",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "234",
        "size": "0",
        "color": "3",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "244",
        "size": "0",
        "color": "4",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "254",
        "size": "0",
        "color": "5",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "264",
        "size": "0",
        "color": "6",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "274",
        "size": "0",
        "color": "7",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "284",
        "size": "0",
        "color": "8",
        "body_shape": "2",
        "body_texture": "1",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "1",
        "power": "0.5"
    }, {
        "name": "314",
        "size": "0",
        "color": "1",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "324",
        "size": "0",
        "color": "2",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "334",
        "size": "0",
        "color": "3",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "344",
        "size": "0",
        "color": "4",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "354",
        "size": "0",
        "color": "5",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "364",
        "size": "0",
        "color": "6",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "374",
        "size": "0",
        "color": "7",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }, {
        "name": "384",
        "size": "0",
        "color": "8",
        "body_shape": "3",
        "body_texture": "2",
        "eye": "0",
        "eye_color": "0",
        "fin1_shape": "0",
        "fin2_shape": "2",
        "power": "0.5"
    }],
    fish_color: [
        {
            "id": 1,
            "name": "green"
        },
        {
            "id": 2,
            "name": "blue"
        },
        {
            "id": 3,
            "name": "red"
        },
        {
            "id": 4,
            "name": "purple"
        },
        {
            "id": 5,
            "name": "pink"
        },
        {
            "id": 6,
            "name": "black"
        },
        {
            "id": 7,
            "name": "white"
        },
        {
            "id": 8,
            "name": "gold"
        }
    ],
    fish_image_cache: {},
    canvas: null,
    convert: function (gene) {
        var obj = {};
        var parts = ["body_color", "size", "body_shape", "body_pattern", "eye_color", "eye_shape", "fin1_shape", "fin2_shape"];
        obj.total_power = 0;
        for (var i = 0; i < parts.length; i++) {
            obj[parts[i]] = this.get_obj(parts[i], this.number_10(gene, i));
            obj.total_power += parseInt(obj[parts[i]].power);
        }
        obj.power_bonus = 0;
        obj.suit = [];
        for (var i = 0; i < this.suit_data.length; i++) {
            var item = this.suit_data[i];
            if ((item.size == 0 || item.size != 0 && item.size == obj.size.id)
                && (item.color == 0 || item.color != 0 && item.color == obj.body_color.id)
                && (item.body_shape == 0 || item.body_shape != 0 && item.body_shape == obj.body_shape.id)
                && (item.body_texture == 0 || item.body_texture != 0 && item.body_texture == obj.body_pattern.id)
                && (item.eye == 0 || item.eye != 0 && item.eye == obj.eye_shape.id)
                && (item.eye_color == 0 || item.eye_color != 0 && item.eye_color == obj.eye_color.id)
                && (item.fin1_shape == 0 || item.fin1_shape != 0 && item.fin1_shape == obj.fin1_shape.id)
                && (item.fin2_shape == 0 || item.fin2_shape != 0 && item.fin2_shape == obj.fin2_shape.id)
            ) {
                if (obj.power_bonus < Number(item.power)) {
                    obj.power_bonus = Number(item.power);
                    obj.suit = [];
                    obj.suit.push(item);
                }
            }
        }
        obj.gene_power = obj.total_power;
        obj.total_power = Math.round(obj.total_power * (1 + obj.power_bonus));
        obj.suit_power = obj.total_power - obj.gene_power;
        var degree = getGrady(obj.total_power);
        obj.power_bonus_label = "";
        if (degree > 1) {
            obj.power_bonus_label = "(" + $.i18n.prop("grady_" + degree) + ")";
        }
        return obj;
    },
    number_10: function (gene, index) {
        return parseInt(gene.substring(2 * index, 2 * index + 2), 16);
    },
    get_obj: function (part, gene) {
        for (var i = 0; i < this.degree_obj[part].length; i++) {
            if (gene == this.degree_obj[part][i].id) {
                return this.degree_obj[part][i];
            }
        }
    },
    create_fish: function (ele, gene) {
        ele.empty();
        var _canvas = $("<canvas width='512' height='512'></canvas>");
        _canvas.appendTo(ele);
        var _array = [];
        this.create_image(_array, gene, "body");
        this.create_image(_array, gene, "eye");
        this.create_image(_array, gene, "eye-socket");
        this.create_image(_array, gene, "fin1");
        this.create_image(_array, gene, "fin2");
        this.create_image(_array, gene, "special");

        for (i = 0; i < _array.length - 1; i++) {
            for (j = 0; j < _array.length - 1 - i; j++) {
                if (_array[j].zindex > _array[j + 1].zindex) {
                    var temp = _array[j];
                    _array[j] = _array[j + 1];
                    _array[j + 1] = temp;
                }
            }
        }
        var size = this.number_10(gene, 1);
        var draw = function (item) {
            var ctx = _canvas[0].getContext("2d");
            var img = new Image();
            img.src = "../img/fish/" + item.part + "/" + FishGene.getFileName(item);
            img.onload = function () {
                console.log("drawImage");
                var w = 512;
                if (size == 3) {
                    ctx.drawImage(img, 0, 0);
                } else if (size == 2) {
                    ctx.drawImage(img, w * (1 - FishGene.fish_size_scale[2]) / 2, w * (1 - FishGene.fish_size_scale[2]) / 2, w * FishGene.fish_size_scale[2], w * FishGene.fish_size_scale[2]);
                } else {
                    ctx.drawImage(img, w * (1 - FishGene.fish_size_scale[1]) / 2, w * (1 - FishGene.fish_size_scale[1]) / 2, w * FishGene.fish_size_scale[1], w * FishGene.fish_size_scale[1]);
                }

            };
            console.log("../img/fish/" + item.part + "/" + FishGene.getFileName(item));
        };
        for (var i in _array) {
            draw(_array[i]);
        }
    },
    create_fish_image: function (ele, gene) {
        if (FishGene.fish_image_cache[gene] != null) {
            if (ele[0].src == FishGene.fish_image_cache[gene]) {
                return;
            }
            ele[0].src = FishGene.fish_image_cache[gene];
            return;
        }
        if (FishGene.canvas == null) {
            FishGene.canvas = $("<canvas width='512' height='512'></canvas>");
        }
        var _canvas = FishGene.canvas;
        var _array = [];
        this.create_image(_array, gene, "body");
        this.create_image(_array, gene, "eye");
        this.create_image(_array, gene, "eye-socket");
        this.create_image(_array, gene, "fin1");
        this.create_image(_array, gene, "fin2");
        this.create_image(_array, gene, "special");

        for (i = 0; i < _array.length - 1; i++) {
            for (j = 0; j < _array.length - 1 - i; j++) {
                if (_array[j].zindex > _array[j + 1].zindex) {
                    var temp = _array[j];
                    _array[j] = _array[j + 1];
                    _array[j + 1] = temp;
                }
            }
        }
        var p = _array.length;
        var size = this.number_10(gene, 1);
        var img_array = [];
        var ctx = _canvas[0].getContext("2d");
        if (ctx == null) {
            return;
        }
        for (var i in _array) {
            var item = _array[i];
            var img = new Image();
            img.src = "../img/fish/" + item.part + "/" + FishGene.getFileName(item);
            img_array.push(img);
            img.onload = function () {
                if (FishGene.fish_image_cache[gene] != null) {
                    if (ele[0].src == FishGene.fish_image_cache[gene]) {
                        return;
                    }
                    ele[0].src = FishGene.fish_image_cache[gene];
                    return;
                }
                p--;
                if (p == 0) {
                    for (var i = 0; i < img_array.length; i++) {
                        var w = 512;
                        if (size == 3) {
                            ctx.drawImage(img_array[i], 0, 0);
                        } else if (size == 2) {
                            ctx.drawImage(img_array[i], w * (1 - FishGene.fish_size_scale[2]) / 2, w * (1 - FishGene.fish_size_scale[2]) / 2, w * FishGene.fish_size_scale[2], w * FishGene.fish_size_scale[2]);
                        } else {
                            ctx.drawImage(img_array[i], w * (1 - FishGene.fish_size_scale[1]) / 2, w * (1 - FishGene.fish_size_scale[1]) / 2, w * FishGene.fish_size_scale[1], w * FishGene.fish_size_scale[1]);
                        }
                    }
                    ele[0].src = _canvas[0].toDataURL("image/png");
                    ctx.clearRect(0, 0, 512, 512);
                    _canvas.remove();
                    _canvas = null;
                    FishGene.fish_image_cache[gene] = ele[0].src;
                    console.log("canvas");
                }
            }
        }
    },
    create_image: function (array, gene, part) {
        var color = this.getColor(this.number_10(gene, 0));
        var size = this.number_10(gene, 1);
        var body_shape = this.number_10(gene, 2);
        var body_texture = this.number_10(gene, 3);
        var eye_color = this.getColor(this.number_10(gene, 4));
        var eye_shape = this.number_10(gene, 5);
        var fin1_shape = this.number_10(gene, 6);
        var fin2_shape = this.number_10(gene, 7);
        var special_shape = this.number_10(gene, 8);
        var _array = [];
        if (this.fish_data[part] == null) {
            return [];
        }
        for (var i = 0; i < this.fish_data[part].length; i++) {
            var _item = this.fish_data[part][i];
            if (part == "body" && _item.color == color && _item.shapeId == body_shape && _item.texture == body_texture
                || part == "eye" && _item.color == eye_color && _item.shapeId == eye_shape && array_contain(_item.bodyshapeId, body_shape)
                || part == "eye-socket" && _item.color == color && _item.shapeId == eye_shape && array_contain(_item.bodyshapeId, body_shape)
                || part == "fin1" && _item.color == color && _item.shapeId == fin1_shape && array_contain(_item.bodyshapeId, body_shape)
                || part == "fin2" && _item.color == color && _item.shapeId == fin2_shape && array_contain(_item.bodyshapeId, body_shape)
                || part == "special" && _item.color == color && _item.shapeId == special_shape && array_contain(_item.bodyshapeId, body_shape)
            ) {
                _array.push(this.fish_data[part][i]);
                array.push(this.fish_data[part][i]);
            }
        }
        return _array;
    },
    getFileName: function (obj) {
        if (obj.part == "body") {
            return obj.part + "_" + obj.shapeId + "_" + obj.color + "_" + obj.texture + "_" + obj.zindex + ".png";
        } else {
            return obj.part + "_" + obj.shapeId + "_" + obj.bodyshapeId.join("-") + "_" + obj.color + "_" + obj.texture + "_" + obj.zindex + ".png";
        }
    },
    getFullFileName: function (obj) {
        return "../img/fish/" + obj.part + "/" + FishGene.getFileName(obj);
    },
    number_10: function (gene, index) {
        return parseInt(gene.substring(2 * index, 2 * index + 2), 16);
    },
    getColor: function (id) {
        for (var i = 0; i < this.fish_color.length; i++) {
            var item = this.fish_color[i];
            if (item.id == id) {
                return item.name;
            }
        }
        return "";
    },
    getRarityIcon: function (rarity) {
        if (rarity == 2) {
            return "../img/icon_gene_green.png";
        } else if (rarity == 3) {
            return "../img/icon_gene_purple.png";
        } else if (rarity == 4) {
            return "../img/icon_gene_gold.png";
        } else {
            return default_image;
        }
    },
    extendFish: function (obj) {
        if (obj.birthday == null) {
            obj.birthday = 1234567;
        }
        obj.birthday_label = new Date(obj.birthday * 1000).Format("yyyy-MM-dd");
        if (obj.gene == null) {
            obj.gene = "0101010101010101";
        }
        obj.gene_obj = FishGene.convert(obj.gene);
        //obj.fishbowl_url = getFishUrl() + obj.gene + ".png";

        obj.fish_border_url = "../img/UI_fish_bg_" + getGrady(obj.gene_obj.total_power) + ".png";

        obj.color_label = $.i18n.prop("color_" + obj.gene_obj.body_color.id);
        obj.size_label = $.i18n.prop("size_" + obj.gene_obj.size.id);
        obj.body_shape_label = $.i18n.prop("body_shape_" + obj.gene_obj.body_shape.id);
        obj.body_texture_label = $.i18n.prop("body_pattern_" + obj.gene_obj.body_pattern.id);
        obj.eye_label = $.i18n.prop("eye_shape_" + obj.gene_obj.eye_shape.id);
        obj.eye_color_label = $.i18n.prop("eye_color_" + obj.gene_obj.eye_color.id);
        obj.fin1_label = $.i18n.prop("fin1_shape_" + obj.gene_obj.fin1_shape.id);
        obj.fin2_label = $.i18n.prop("fin2_shape_" + obj.gene_obj.fin2_shape.id);

        obj.rare = 0;
        obj.epic = 0;
        obj.legendary = 0;

        var _array = [];

        if (obj.gene_obj.body_color.degree > 1) {
            obj.color_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.body_color.degree) + ")";
            _array.push(obj.gene_obj.body_color.degree);
        } else {
            obj.color_grady = "";
        }
        if (obj.gene_obj.size.degree > 1) {
            obj.size_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.size.degree) + ")";
            _array.push(obj.gene_obj.size.degree);
        } else {
            obj.size_grady = "";
        }
        if (obj.gene_obj.body_shape.degree > 1) {
            obj.body_shape_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.body_shape.degree) + ")";
            _array.push(obj.gene_obj.body_shape.degree);
        } else {
            obj.body_shape_grady = "";
        }
        if (obj.gene_obj.body_pattern.degree > 1) {
            obj.body_pattern_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.body_pattern.degree) + ")";
            _array.push(obj.gene_obj.body_pattern.degree);
        } else {
            obj.body_pattern_grady = "";
        }
        if (obj.gene_obj.eye_shape.degree > 1) {
            obj.eye_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.eye_shape.degree) + ")";
            _array.push(obj.gene_obj.eye_shape.degree);
        } else {
            obj.eye_grady = "";
        }
        if (obj.gene_obj.eye_color.degree > 1) {
            obj.eye_color_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.eye_color.degree) + ")";
            _array.push(obj.gene_obj.eye_color.degree);
        } else {
            obj.eye_color_grady = "";
        }
        if (obj.gene_obj.fin1_shape.degree > 1) {
            obj.fin1_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.fin1_shape.degree) + ")";
            _array.push(obj.gene_obj.fin1_shape.degree);
        } else {
            obj.fin1_grady = "";
        }
        if (obj.gene_obj.fin2_shape.degree > 1) {
            obj.fin2_grady = "(" + $.i18n.prop("grady_" + obj.gene_obj.fin2_shape.degree) + ")";
            _array.push(obj.gene_obj.fin2_shape.degree);
        } else {
            obj.fin2_grady = "";
        }

        obj.color_rarity = FishGene.getRarityIcon(obj.gene_obj.body_color.degree);
        obj.size_rarity = FishGene.getRarityIcon(obj.gene_obj.size.degree);
        obj.body_rarity = FishGene.getRarityIcon(obj.gene_obj.body_shape.degree);
        obj.body_pattern_rarity = FishGene.getRarityIcon(obj.gene_obj.body_pattern.degree);
        obj.eye_rarity = FishGene.getRarityIcon(obj.gene_obj.eye_shape.degree);
        obj.eye_color_rarity = FishGene.getRarityIcon(obj.gene_obj.eye_color.degree);
        obj.fin1_rarity = FishGene.getRarityIcon(obj.gene_obj.fin1_shape.degree);
        obj.fin2_rarity = FishGene.getRarityIcon(obj.gene_obj.fin2_shape.degree);

        for (var i = 0; i < _array.length; i++) {
            if (_array[i] == 2) {
                obj.rare++;
            } else if (_array[i] == 3) {
                obj.epic++;
            } else {
                obj.legendary++;
            }
        }

        obj.grady_label = $.i18n.prop("grady_" + getGrady(obj.gene_obj.total_power));

        obj.size_suit = default_image;
        obj.color_suit = default_image;
        obj.body_suit = default_image;
        obj.body_pattern_suit = default_image;
        obj.eye_suit = default_image;
        obj.eye_color_suit = default_image;
        obj.fin1_suit = default_image;
        obj.fin2_suit = default_image;
        var suit_image = "../img/icon_gene_x.png";
        obj.suit_piece = 0;
        if (obj.gene_obj.suit.length > 0) {
            var item = obj.gene_obj.suit[0];
            if (item.size > 0) {
                obj.size_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.color > 0) {
                obj.color_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.body_shape > 0) {
                obj.body_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.body_texture > 0) {
                obj.body_pattern_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.eye > 0) {
                obj.eye_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.eye_color > 0) {
                obj.eye_color_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.fin1_shape > 0) {
                obj.fin1_suit = suit_image;
                obj.suit_piece++;
            }
            if (item.fin2_shape > 0) {
                obj.fin2_suit = suit_image;
                obj.suit_piece++;
            }
        }
    }
};

window.addEventListener('error', function (err) {
    var lineAndColumnInfo = err.colno ? ' line:' + err.lineno + ', column:' + err.colno : ' line:' + err.lineno;
    var stack = "|" + err.stack + "|";
    if (typeof ga == "function") {
        ga(
            'send',
            'event',
            'JavaScript Error',
            err.message,
            err.filename + stack + lineAndColumnInfo + ' -> ' + navigator.userAgent,
            0,
            true
        );
    }
});